<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no"/>
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<title>AutoCode</title>
<link rel="shortcut icon" href="/favicon.ico" />
<script src="/links/jquery/jquery-3.5.1.min.js"></script>
<script src="/links/polyfill.min.js"></script>
<script src="/links/axios/axios.min.js"></script>
<script src="/links/vue/vue.min.js"></script>
<script src="/links/element-ui/index.js"></script>
<script src="/links/dayjs.min.js"></script>
<script src="/links/echarts/echarts.js"></script>
<script src="/links/JsBarcode.all.js"></script>
<script src="/links/qrcode.min.js"></script>
<script src="/links/layer/layer.js"></script>
<script src="/links/crypto/crypto-js.js"></script>
<script src="/js/dragController.js"></script>
<script src="/js/HttpApi.js"></script>
<script src="/js/AutoCode.js"></script>
<link href="/links/element-ui/theme/index.css" rel="stylesheet"/>
<link href="/css/default.css" rel="stylesheet"/>
<link href="/css/dragController.css" rel="stylesheet"/>
    <script src="/links/ace/src/ace.js"></script>
<script src="/links/ace/src/ext-language_tools.js"></script>
    <style>
        
    </style>
</head>
<body>
<div id="app"  class="box " >
<div class="left " style="width:400px;">
<div class="flex ac-tree-head ac-tree-head-default-line">
    <div class="ac-tree-title"></div>
    <div class="ac-tree-oper">
        <el-button size="medium"  v-if="appMenuTree.operVisible.buttonQ" @click="appMenuTree_load()" :disabled="appMenuTree.operDisabled.buttonQ"  type="text"     native-type="button">刷新(R)</el-button>
<el-button size="medium"  v-if="appMenuTree.operVisible.buttonA" @click="appMenuTree_openAppMenuAdd()" :disabled="appMenuTree.operDisabled.buttonA"  type="text"     native-type="button">添加(A)</el-button>

    </div>
</div>
<div style="padding:5px 10px;">
    <el-input size="mini" placeholder="输入关键字进行过滤" v-model="appMenuTree.filterValue"></el-input>
</div>
<div class="ac-tree-content2">
    <el-tree ref="appMenuTree" :data="appMenuTree.data"
    :expand-on-click-node="false" node-key="id" empty-text="内容为空"
    highlight-current :current-node-key="appMenuTree.currentNodeKey"  
       
    :filter-node-method="appMenuTree_filterNodeMethod"
      
    draggable :allow-drag="appMenuTree_allowDrag" :allow-drop="appMenuTree_allowDrop" @node-drop="appMenuTree_nodeDrop"
    
    @current-change="appMenuTree_currentChange"
    >
    <span class="custom-tree-node" slot-scope="{ node, data }">
    <span>
        <i class="el-icon-document" v-if="data.menuType==1"></i>
        <i class="el-icon-folder" v-else></i>

        {{ data.name }}
    </span>
    <span>
        <el-dropdown size="small" @command="appMenuTree_treeCommand">
            <el-link icon="el-icon-more"></el-link>
            <el-dropdown-menu slot="dropdown">
                <el-dropdown-item :command="{'flag':'addChildren','nodeData':data}">添加下级</el-dropdown-item>
                <el-dropdown-item v-if="!data.children || data.children.length==0" :command="{'flag':'del','nodeData':data}">删除</el-dropdown-item>
            </el-dropdown-menu>
        </el-dropdown>
    </span>
</span>
</el-tree>

</div>
</div>
<div class="resize"></div>
<div class="right " style="width:calc(100% - 402px);">
<div class="box"><div class="topBox " style="height:200px;">
 <div class="flex ac-form-head ac-form-head-default-line">
    <div class="ac-form-title"></div>
    <div class="ac-form-oper"><el-button size="medium"  v-if="appMenuInfo.operVisible.buttonC" @click="appMenuInfo_save()" :disabled="appMenuInfo.operDisabled.buttonC"  type="text"     native-type="button">保存</el-button>
</div>
</div>
<div class="ac-form-content">
    <el-form class="ac-el-form"    label-width="80px" label-position="right"
     size="mini" ref="appMenuInfo" :model="appMenuInfo.data" :rules="appMenuInfo.rules"  
     :disabled="appMenuInfo.disabled" @submit.native.prevent>
    <el-row><el-col :span=12 v-if="appMenuInfo.itemVisible.name">
    <el-form-item prop="name" label="菜单名称">
        
<el-input type="text" size="mini"  v-model="appMenuInfo.data.name" placeholder="菜单名称" :disabled="appMenuInfo.itemDisabled.name" @change="appMenuInfo_change('name',appMenuInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="appMenuInfo.itemVisible.showName">
    <el-form-item prop="showName" label="显示名称">
        
<el-input type="text" size="mini"  v-model="appMenuInfo.data.showName" placeholder="显示名称" :disabled="appMenuInfo.itemDisabled.showName" @change="appMenuInfo_change('showName',appMenuInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="appMenuInfo.itemVisible.url">
    <el-form-item prop="url" label="菜单URL">
        
<el-input type="text" size="mini"  v-model="appMenuInfo.data.url" placeholder="菜单URL" :disabled="appMenuInfo.itemDisabled.url" @change="appMenuInfo_change('url',appMenuInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="appMenuInfo.itemVisible.icon">
    <el-form-item prop="icon" label="菜单图标">
        
<el-input type="text" size="mini"  v-model="appMenuInfo.data.icon" placeholder="菜单图标" :disabled="appMenuInfo.itemDisabled.icon" @change="appMenuInfo_change('icon',appMenuInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="appMenuInfo.itemVisible.image">
    <el-form-item prop="image" label="图片路径">
        
<el-input type="text" size="mini"  v-model="appMenuInfo.data.image" placeholder="图片路径" :disabled="appMenuInfo.itemDisabled.image" @change="appMenuInfo_change('image',appMenuInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="appMenuInfo.itemVisible.hasCalc">
     <el-form-item prop="hasCalc" label="计算文本">
    <el-checkbox v-model="appMenuInfo.data.hasCalc" true-label='Y' false-label='N'></el-checkbox>
    <el-button type="text" size="mini" v-if="appMenuInfo.data.hasCalc=='Y'" @click="appMenuInfo_editJavaEditor">设置计算文本</el-button>
</el-form-item>
</el-col>
</el-row>
 </el-form>

</div>
</div>
<div class="move"></div>
<div class="downBox " style="height:calc(100% - 202px);">
<el-tabs type="border-card" v-model="page.tabs" class=""  >
<el-tab-pane class="" label="授权单位" name="tab1" :disabled="tabDisabled.tab1" v-if="tabVisible.tab1" >
<div class="flex ac-table-head">
    <div class="ac-table-oper"><el-button size="medium"  v-if="appMenuOrgan.operVisible.add" @click="appMenuOrgan_openSelectOrgan()" :disabled="appMenuOrgan.operDisabled.add"  type="text"     native-type="button">添加(A)</el-button>
<el-button size="medium"  v-if="appMenuOrgan.operVisible.del" @click="appMenuOrgan_delete()" :disabled="appMenuOrgan.operDisabled.del"  type="text"     native-type="button">删除(D)</el-button>
</div>
    <div></div>
</div>
<div class="ac-table-content2">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="appMenuOrgan.data" size="mini" ref="appMenuOrgan"
       
    height="100%"
    @current-change="appMenuOrgan_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="orgCode" label="机构代码"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.orgCode}}
   </template>
</el-table-column>
<el-table-column prop="label" label="机构名称"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="orgType" label="机构类型"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.orgType}}
   </template>
</el-table-column>
<el-table-column prop="contact" label="联系人"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.contact}}
   </template>
</el-table-column>
<el-table-column prop="tel" label="电话"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.tel}}
   </template>
</el-table-column>
<el-table-column prop="email" label="邮箱"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.email}}
   </template>
</el-table-column>

</el-table>

</div>
<div class="flex">
    <div></div>
    <div> <el-pagination
      @size-change="appMenuOrgan_pageSizeChange"
      @current-change="appMenuOrgan_pageCurrentChange"
      :current-page="appMenuOrgan.pagingData.currentPage"
      :page-sizes="appMenuOrgan.pagingData.pageSizes"
      :page-size="appMenuOrgan.pagingData.pageSize"
      layout="total, sizes, prev, pager, next"
      :total="appMenuOrgan.pagingData.total"
       
      >
    </el-pagination>
</div>
</div>
</el-tab-pane>

</el-tabs>

</div>
</div>
</div>

<el-dialog :visible.sync="selectOrgan.visible" :title="selectOrgan.title"
            width="80%"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;height:400px;">
                <div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="selectOrgan.data" size="mini" ref="selectOrgan"
       
    height="100%"
    @current-change="selectOrgan_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="code" label="组织机构代码"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.code}}
   </template>
</el-table-column>
<el-table-column prop="label" label="组织机构名称"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="orgType" label="组织机构类型"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        <template v-for="dict in dictOptions.orgType" v-if="scope.row.orgType==dict.value"> <i :style="{color:dict.iconColor}" :class="dict.icon"></i> <label :style="{color:dict.fontColor}">{{dict.label}}</label></template>
   </template>
</el-table-column>
<el-table-column prop="contact" label="联系人"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.contact}}
   </template>
</el-table-column>
<el-table-column prop="tel" label="电话"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.tel}}
   </template>
</el-table-column>
<el-table-column prop="email" label="邮箱"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.email}}
   </template>
</el-table-column>
<el-table-column prop="address" label="详细地址"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.address}}
   </template>
</el-table-column>

</el-table>

</div>
<div class="flex">
    <div></div>
    <div> <el-pagination
      @size-change="selectOrgan_pageSizeChange"
      @current-change="selectOrgan_pageCurrentChange"
      :current-page="selectOrgan.pagingData.currentPage"
      :page-sizes="selectOrgan.pagingData.pageSizes"
      :page-size="selectOrgan.pagingData.pageSize"
      layout="total, sizes, prev, pager, next"
      :total="selectOrgan.pagingData.total"
       
      >
    </el-pagination>
</div>
</div>
            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="selectOrgan_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="selectOrgan_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="appMenuAdd.visible" :title="appMenuAdd.title"
            width="50%"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""  :show-message="false"  label-width="80px" label-position="right"
     size="mini" ref="appMenuAdd" :model="appMenuAdd.data" :rules="appMenuAdd.rules"  
     :disabled="appMenuAdd.disabled" @submit.native.prevent>
    <el-row><el-col :span=24 v-if="appMenuAdd.itemVisible.name">
    <el-form-item prop="name" label="菜单名称">
        
<el-input type="text" size="mini"  v-model="appMenuAdd.data.name" placeholder="菜单名称" :disabled="appMenuAdd.itemDisabled.name"  @keyup.enter.native="appMenuAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="appMenuAdd.itemVisible.url">
    <el-form-item prop="url" label="URL地址">
        
<el-input type="text" size="mini"  v-model="appMenuAdd.data.url" placeholder="URL地址" :disabled="appMenuAdd.itemDisabled.url"  @keyup.enter.native="appMenuAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="appMenuAdd.itemVisible.image">
    <el-form-item prop="image" label="图片路径">
        
<el-input type="text" size="mini"  v-model="appMenuAdd.data.image" placeholder="图片路径" :disabled="appMenuAdd.itemDisabled.image"  @keyup.enter.native="appMenuAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="appMenuAdd.itemVisible.icon">
    <el-form-item prop="icon" label="图标">
        
<el-input type="text" size="mini"  v-model="appMenuAdd.data.icon" placeholder="图标" :disabled="appMenuAdd.itemDisabled.icon"  @keyup.enter.native="appMenuAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="appMenuAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="appMenuAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="javaEditor.visible" :title="javaEditor.title"
            width="50%"
               
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div id="javaEditor" style="height:60vh;border: 1px solid #9f9f9f;"></div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="javaEditor_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="javaEditor_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>


</div>

</body>
<script th:inline="javascript">
    let vm = new Vue({
            el: '#app',
            data() {
                return {"appMenuTree":{"title":"APP菜单列表","data":[],"filterValue":"","defaultCheckedKeys":[],"currentNodeKey":{},"operData":{},"operVisible":{"buttonA":true,"buttonQ":true},"operDisabled":{},"currentRow":{}},"appMenuInfo":{"title":"菜单信息","data":{},"operData":{},"operVisible":{"buttonC":true},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{"name":true,"hasCalc":true,"url":true,"icon":true,"showName":true,"image":true},"itemDisabled":{},"transfer":{},"rules":{"name":[{"required":true,"message":"请输入菜单名称","trigger":"blur"}]}},"appMenuOrgan":{"title":"授权组织机构","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{"currentPage":1,"total":0,"pageSize":20,"pageSizes":[10,20,30,40,50,100]},"operData":{},"operVisible":{"del":true,"add":true},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"page":{"tabs":"tab1"},"tabDisabled":{"tab1":false},"tabVisible":{"tab1":true},"customOptions":{},"dictOptions":{},"selectOrgan":{"visible":false,"title":"选择组织机构","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{"currentPage":1,"total":0,"pageSize":20,"pageSizes":[10,20,30,40,50,100]},"operData":{},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"appMenuAdd":{"visible":false,"title":"添加菜单","data":{"icon":"el-icon-folder"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{"name":true,"url":true,"icon":true,"image":true},"itemDisabled":{},"transfer":{},"rules":{"name":[{"required":true,"message":"请输入菜单名称","trigger":"blur"}]}},"javaEditor":{"visible":false,"title":"菜单计算器注解名称","operData":{},"operVisible":{},"operDisabled":{},"data":[]}}
            },
            watch: {
"appMenuTree.filterValue":function(val){
	this.$refs.appMenuTree.filter(val);
},
"appMenuInfo.data.url":function(newVal, oldVal) {
    if (this.appMenuInfo.data.id) {
        HttpApi.updateProvider("sysMenus", "url", this.appMenuInfo.data, function() {

        });
    }
}},
            methods: {
appMenuTree_allowDrag:function(node){
    return true;
},
selectOrgan_change:function(fieldName,row){
    HttpApi.updateProvider("sysOrgan",fieldName,row,function(){
                        
    });
},
appMenuAdd_change:function(fieldName){
    HttpApi.updateProvider("appMenus",fieldName,this.appMenuAdd.data,function(){

    });
},
selectOrgan_pageCurrentChange:function(currentPage){
    this.selectOrgan.pagingData.currentPage=currentPage;
    this.selectOrgan_load();
}
,
appMenuTree_treeCommand:function(param) {
    let that = this;
    if (param.flag == "addChildren") {
        let dialogParam = {};
        dialogParam.parentId = param.nodeData.id;
        dialogParam.menuType = '1';
        that.appMenuAdd_dialogOpen(dialogParam, function(dialogData) {
            HttpApi.saveProvider("appMenus", dialogData, function(res) {
                if (res.parentId == "-1") {
                    that.appMenuTree.data.push(res);
                } else {
                    that.$refs.appMenuTree.append(res, res.parentId);
                }
                that.appMenuAdd.visible = false;
            });
        })
    }
    if (param.flag == "del") {
        HttpApi.postConfirm("/platform/menus/delApp", param.nodeData, function(res) {
            that.$refs.appMenuTree.remove(param.nodeData);
            that.appMenuTree_currentChange();
        });
    }
},
selectOrgan_pageSizeChange:function(pageSize){
    this.selectOrgan.pagingData.pageSize=pageSize;
    this.selectOrgan_load();
}
,
appMenuTree_nodeDrop:function(draggingNode, dropNode, dropType, ev) {
    let that = this;
    /*共四个参数，依次为：被拖拽节点对应的 Node、结束拖拽时最后进入的节点、
        被拖拽节点的放置位置（before、after、inner）、event	*/
    if (draggingNode.data.menuType == dropNode.data.menuType) {
        if (draggingNode.data.parentId == dropNode.data.parentId) {
            let ids = [];
            let childNodes = dropNode.parent.childNodes;
            let ll = childNodes.length;
            for (let l = 0; l < ll; l++) {
                ids.push(childNodes[l].data.id);
            }
            HttpApi.post("/platform/menus/sortApp", {
                "ids": ids,
                "parentId": dropNode.data.parentId
            }, function(res) {
                that.$message.success("移动成功");
            });
        } else {
            HttpApi.post("/platform/menus/moveApp", {
                "id": draggingNode.data.id,
                "parentId": dropNode.data.parentId
            }, function(res) {
                that.$set(draggingNode.data, "parentId", dropNode.data.parentId);
                that.$message.success("移动成功");
            });
        }

    } else {
        HttpApi.post("/platform/menus/moveApp", {
            "id": draggingNode.data.id,
            "parentId": dropNode.data.id
        }, function(res) {
            that.$set(draggingNode.data, "parentId", dropNode.data.id);
            that.$message.success("移动成功");
        });
    }
},
appMenuOrgan_openSelectOrgan:function() {
    let that = this;
    this.appMenuOrgan.operData.menuType = "APP";
    this.selectOrgan_dialogOpen(this.appMenuOrgan.operData, function(dialogData) {
        dialogData.forEach(function(item, index) {
            if (item.id) {
                delete item.id;
            }
            item.menuId = that.appMenuOrgan.operData.menuId;
            item.orgCode = item.code;
        });
        HttpApi.saveBatchProvider("appOrganMenu", dialogData, function(res) {
            that.selectOrgan.visible = false;
            that.appMenuOrgan_load();
        });
    })
},
appMenuTree_allowDrop:function(draggingNode, dropNode, type){
    /*拖拽时判定目标节点能否被放置。
    type ：'prev'、'inner' 和 'next'，
    分别表示放置在目标节点前、插入至目标节点和放置在目标节点后*/
    if(draggingNode.data.menuType=="0"&&dropNode.data.menuType=="0"&&type!='inner'){
		return true;
	}else if(draggingNode.data.menuType=="1"&&dropNode.data.menuType=="0"&&type=='inner'){
		return true;
	}else if(draggingNode.data.menuType=="1"&&dropNode.data.menuType=="1"&&type!='inner'){
		return true;
	}else{
		return false;
	}
},
appMenuAdd_dialogOpen:function(param,callback){
    this.$data.appMenuAdd.data = this.$options.data().appMenuAdd.data;
    this.$data.appMenuAdd.operData = this.$options.data().appMenuAdd.operData;
    for(let val in param) {
        this.$set(this.appMenuAdd.data, val, param[val])
    }
    this.appMenuAdd.callback=callback;
    this.appMenuAdd.visible = true;
}
,
appMenuTree_check:function(node,list){

}
,
appMenuAdd_dialogOk:function(){
    let that = this;
    this.$refs.appMenuAdd.validate(function(valid){
        if(valid){
            that.appMenuAdd.callback(that.appMenuAdd.data);
        }else{
            return false;
        }
    });
},
selectOrgan_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.selectOrgan.currentRow = this.$options.data().selectOrgan.currentRow;
    }else{
        this.selectOrgan.currentRow = currentRow;
    }
    this.selectOrgan_operCtrl(currentRow);
},
appMenuTree_load:function(node, resolve) {
    let that = this;
    if (node) {
        HttpApi.queryArray("appMenus", {
            "parentId": node.id
        }, function(res) {
            return resolve(res);
        });
    } else {
        HttpApi.queryTree("appMenus", this.appMenuTree.operData, function(treeData) {
            that.appMenuTree.data = treeData;
            if (treeData.length > 0) {
                that.$nextTick(function() {
                    /*that.$refs.appMenuTree.setCurrentKey(treeData[0].id);
                    that.appMenuTree_currentChange(treeData[0]);*/
                });
            } else {
                that.appMenuTree_currentChange();
            }
        });
    }

},
appMenuInfo_save:function(param) {
    let that = this;
    delete this.appMenuInfo.data["calcName"];
    HttpApi.saveProvider("appMenus", this.appMenuInfo.data, function(res) {
        that.$message.success("保存成功");
        /*请补充方法信息*/
    });
},
appMenuOrgan_delete:function() {
    let that = this;
    let selection = that.$refs.appMenuOrgan.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }
    HttpApi.delBatchProviderConfirm("appOrganMenu", selection, function(res) {
        for (let i = 0; i < selLength; i++) {
            let index = that.appMenuOrgan.data.findIndex(function(item) {
                return item.id == selection[i].id;
            });
            that.appMenuOrgan.data.splice(index, 1);
        }

        if (that.appMenuOrgan.data.length == 0) {
            that.$data.appMenuOrgan.currentRow = that.$options.data().appMenuOrgan.currentRow;
            that.$refs.appMenuOrgan.setCurrentRow();
        } else {
            that.$refs.appMenuOrgan.setCurrentRow(that.appMenuOrgan.data[0]);
        }
        that.$message.success("删除成功");
    });
},
appMenuOrgan_pageSizeChange:function(pageSize){
    this.appMenuOrgan.pagingData.pageSize=pageSize;
    this.appMenuOrgan_load();
}
,
appMenuOrgan_load:function() {
    let that = this;
    let param = {};
    this.appMenuOrgan.operData.menuType="APP";
    param.pagingData = this.appMenuOrgan.pagingData;
    param.operData = this.appMenuOrgan.operData;
    HttpApi.queryDs("platformMenu.authOrgan", param, function(res) {
        that.appMenuOrgan.data = res.data;
        that.appMenuOrgan.pagingData = res.pagingData;
        if (that.appMenuOrgan.data.length > 0) {
            that.$refs.appMenuOrgan.setCurrentRow(that.appMenuOrgan.data[0]);
            that.appMenuOrgan_operCtrl(that.appMenuOrgan.data[0]);
        } else {
            that.$refs.appMenuOrgan.setCurrentRow();
            that.appMenuOrgan_operCtrl();
        }
    });
},
appMenuOrgan_change:function(fieldName,row){
    HttpApi.updateProvider("sysOrganMenu",fieldName,row,function(){
                        
    });
},
appMenuOrgan_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.appMenuOrgan.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.appMenuOrgan.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       
    }else {
       
    }
},
appMenuTree_currentChange: function(data,node){
    if(data){
        this.appMenuTree.currentNodeKey=data.id;
        this.appMenuTree.currentRow = data;
        this.appMenuInfo.editorForm=true;
this.appMenuInfo.operData.id=data.id;
this.appMenuInfo_load();
    this.appMenuOrgan.operData.menuId=data.id;

this.appMenuOrgan_load();

    }else{
        this.$data.appMenuTree.currentNodeKey=this.$options.data().appMenuTree.currentNodeKey;
        this.$data.appMenuTree.currentRow = this.$options.data().appMenuTree.currentRow;
        this.$data.appMenuInfo.operData=this.$options.data().appMenuInfo.operData;
this.$data.appMenuInfo.data=this.$options.data().appMenuInfo.data;
this.$data.appMenuOrgan.operData=this.$options.data().appMenuOrgan.operData;
this.$data.appMenuOrgan.data=this.$options.data().appMenuOrgan.data;

    }
},
appMenuOrgan_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.appMenuOrgan.currentRow = this.$options.data().appMenuOrgan.currentRow;
    }else{
        this.appMenuOrgan.currentRow = currentRow;
    }
    this.appMenuOrgan_operCtrl(currentRow);
},
appMenuAdd_load:function(){
    let that = this;
    HttpApi.queryObject("appMenus",this.appMenuAdd.operData,function(res){
        that.appMenuAdd.data = res;
    });
},
javaEditor_dialogOk:function(){
     let content = this.javaEditor.data.getSession().getValue();
    this.javaEditor.callback(content);
},
appMenuInfo_load:function() {
    let that = this;
    HttpApi.queryObject("appMenus", this.appMenuInfo.operData, function(res) {
        that.appMenuInfo.data = res;
    });
},
selectOrgan_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.selectOrgan.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.selectOrgan.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       
    }else {
       
    }
},
selectOrgan_dialogCancel:function(){
     this.selectOrgan.visible = false;
},
javaEditor_dialogOpen:function(param,callback){
    this.javaEditor.callback=callback;
    this.javaEditor.visible = true;
    this.javaEditor_load(param.content);
}
,
selectOrgan_dialogOk:function(){
      let that = this;
      let selection = that.$refs.selectOrgan.selection;
      let selLength = selection.length;
      if(selLength==0){
          that.$alert("请至少选择一条数据!");
          return;
      }else{
          this.selectOrgan.callback(selection);
      }
},
selectOrgan_delete:function() {
    let that = this;
    let selection = that.$refs.selectOrgan.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }
    HttpApi.delBatchProviderConfirm("sysOrgan", selection, function(res) {
        for (let i = 0; i < selLength; i++) {
            let index = that.selectOrgan.data.findIndex(function(item) {
                return item.id == selection[i].id;
            });
            that.selectOrgan.data.splice(index, 1);
        }

        if (that.selectOrgan.data.length == 0) {
            that.$data.selectOrgan.currentRow = that.$options.data().selectOrgan.currentRow;
            that.$refs.selectOrgan.setCurrentRow();
        } else {
            that.$refs.selectOrgan.setCurrentRow(that.selectOrgan.data[0]);
        }
        that.$message.success("删除成功");
    });
},
javaEditor_dialogCancel:function(){
     this.javaEditor.visible = false;
},
selectOrgan_dialogOpen:function(param,callback){
    this.$data.selectOrgan.data = this.$options.data().selectOrgan.data;
    this.$data.selectOrgan.operData = this.$options.data().selectOrgan.operData;
    this.$data.selectOrgan.currentRow = this.$options.data().selectOrgan.currentRow;
    for(let val in param) {
        this.$set(this.selectOrgan.operData, val, param[val])
    }
    this.selectOrgan.callback=callback;
    this.selectOrgan.visible = true;
    this.selectOrgan_load();
}
,
appMenuInfo_change:function(fieldName) {
    HttpApi.updateProvider("appMenus", fieldName, this.appMenuInfo.data, function() {

    });
},
appMenuAdd_dialogCancel:function(){
     this.appMenuAdd.visible = false;
},
appMenuInfo_editJavaEditor:function() {
    /*没有定义方法模板，需要去定义方法模板*/
    let that = this;

    HttpApi.post("/platform/menus/queryAppCalc", {
        "id": this.appMenuInfo.data.id
    }, function(res) {
        that.javaEditor_dialogOpen(res, function(dialogData) {
            /*需要完善内容*/
            res.content = dialogData;
            HttpApi.post("/platform/menus/saveAppCalc", res, function(res2) {
                that.$message.success("保存成功");
                that.javaEditor.visible = false;
            });
        })
    });
},
selectOrgan_load:function() {
    let that = this;
    let param = {};
    param.pagingData = this.selectOrgan.pagingData;
    param.operData = this.selectOrgan.operData;
    HttpApi.queryDs("platformMenu.notAuthOrgan", param, function(res) {
        that.selectOrgan.pagingData = res.pagingData;
        that.selectOrgan.data = res.data;
        if (that.selectOrgan.data.length > 0) {
            that.$refs.selectOrgan.setCurrentRow(that.selectOrgan.data[0]);
            that.selectOrgan_operCtrl(that.selectOrgan.data[0]);
        } else {
            that.$refs.selectOrgan.setCurrentRow();
            that.selectOrgan_operCtrl();
        }
    });
},
javaEditor_initAceEditor:function(param){
    this.javaEditor.data = ace.edit("javaEditor",{
						fontSize: 14, // 编辑器内字体大小
						minLines:100,
						showPrintMargin:false,
						showLineNumbers:true,
						showGutter:true,
						enableLiveAutocompletion:true,
						enableSnippets:true,
						enableBasicAutocompletion:true
	});
	this.javaEditor.data.setTheme("ace/theme/eclipse");
	this.javaEditor.data.session.setMode("ace/mode/java");
}
,
javaEditor_load:function(content){
    let that = this;
	this.$nextTick(function(){
		that.javaEditor_initAceEditor();
		that.javaEditor.data.getSession().setValue(content);
	});
}
,
appMenuTree_filterNodeMethod:function(value, data) {
    if (!value) return true;
    let lowValue = value.toLowerCase();
    return data.name.toLowerCase().indexOf(lowValue) !== -1;
},
appMenuOrgan_pageCurrentChange:function(currentPage){
    this.appMenuOrgan.pagingData.currentPage=currentPage;
    this.appMenuOrgan_load();
}
,
appMenuTree_openAppMenuAdd:function() {
    let that = this;
    this.appMenuAdd.editorForm = false;
    let param = {};
    this.appMenuAdd_dialogOpen(param, function(dialogData) {
        HttpApi.saveProvider("appMenus", dialogData, function(res) {
            if (res.parentId == "-1" || res.parentId == "0") {
                that.appMenuTree.data.push(res);
            } else {
                that.$refs.appMenuTree.append(res, res.parentId);
            }
            that.appMenuAdd.visible = false;
        });
    })
}
},
            mounted: function(){
    dragControllerLR();
    dragControllerUD();
},
            created: function(){
    let that=this;
    //获取字典信息
    HttpApi.dictOptions(["orgType"],function(res){
        that.dictOptions=res;
    });

    //加载自定义数据字典
    

    //加载初始化load
    this.appMenuTree_load();


    //加载初始化方法
    
}
    });
    

    
</script>
</html>
